/* 
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

var $ = jQuery.noConflict();

jQuery(document).ready(function($){
    
    $(document).on('click', '.treeNetwork .toggle', function(){
        if(!$(this).hasClass('show')){
            $(this).addClass('show');
            $(this).next('.block').slideDown();
        }else{
            $(this).removeClass('show');
            $(this).next('.block').slideUp();
        }
    });
    
    $('#tabnav2 .top_level>li').hover(function(){
        $(this).addClass('active');
    }, function(){
        $(this).removeClass('active');
    });
    
    var ww = $(window).width();
    if(ww <= 1024){
        $('.form-target').addClass('not-fixed');
        
        $('.editaj').on('click', function() {
            $('html, body').animate({ scrollTop: 0 }, 'slow', function () {
                //
            });
        });
    }
});


var now = 0;
if($('body').find('.form-target').length != 0){
    var target = $('.form-target').offset().top;
}

$(window).scroll(function(){
    now = $(this).scrollTop();
	console.log('now:'+now);
    if(!$('.form-target').hasClass('not-fixed')){
        if(now > target){
            $('.form-target').addClass('target-fixed');
        }else{
            $('.form-target').removeClass('target-fixed');
        }
    }
});